package crawler;

import java.io.*;
import java.net.URL;

public class WebsiteReader {
	
	/**
	 * @param url
	 * @return
	 */
	public static String Read(String url)
	{
		BufferedReader reader = null;
		String pageContent = "";
		try
		{
			//this reader will read the internet page
			reader = new BufferedReader(
					new InputStreamReader(
							new URL(url).openStream()));
			
			//start reading the content
			String line = reader.readLine();
			
			while (line != null)
			{
				pageContent += line;
				line = reader.readLine();
			}
		}catch (Exception e)
		{
			e.printStackTrace();
			System.out.println(e.getMessage());
		}
		finally
		{
			try{
				reader.close();
			}catch (Exception e){}
		}
		
		return pageContent;
		
	}
	
	
}
